
Visual Basic (Declaration) | |
---|---|
Public MustInherit Class DesignTimeViewModelLocatorBase(Of T As IdeaBlade.EntityModel.EntityManager) |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As DesignTimeViewModelLocatorBase(Of T) |
C# | |
---|---|
public abstract class DesignTimeViewModelLocatorBase<T> where T: IdeaBlade.EntityModel.EntityManager |
C++/CLI | |
---|---|
generic<typename T> public ref class DesignTimeViewModelLocatorBase abstract where T: IdeaBlade.EntityModel.EntityManager |
- T
- The type of the EntityManager
To implement a concrete ViewModelLocator for your project, extend from this class and override the CreateEntityManager() method. Return an instance of type subclass of DesignTimeEntityManagerProviderBase. Add references to all the view models in the module or application and by adding the following lines of code for each ViewModel. Implement a Start() method to initialize the ViewModel.
public CustomerListViewModel CustomerListViewModel { get { return new CustomerListViewModel().Start(); } }
In Silverlight and WPF, place the ViewModelLocator in the App.xaml resources:
<Application.Resources> <designTime:ViewModelLocator xmlns:designTime="clr-namespace:your-namespace" x:Key="ViewModeLocator" /> </Application.Resources>
Then use:
d:DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=ViewModelName}"
System.Object
Cocktail.DesignTimeViewModelLocatorBase<T>
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family